<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <cpn2></cpn2>
    </div>

    <script src="../js/vue.js"></script>
    <script>
        //第一个组件构造器(子组件)
        const cpnC1 = Vue.extend({
            template: `
                <div>
                    <h2>苏州大学</h2>  
                    <p>养天地正气,法古今完人</p>  
                </div>
            `
        })

        //第二个组件构造器(父组件)
        const cpnC2 = Vue.extend({
            template: `
                <div>
                    <h2>苏州</h2>
                    <cpn1></cpn1>
                </div>
            `,
            components: {
                cpn1: cpnC1 //在一个组件中注册了另外一个组件
            }
        })

        //root组件
        const app = new Vue({
            el: '#app',
            data: {
                message: '苏州大学'
            },
            components: {
                // cpn1: cpnC1,
                cpn2: cpnC2
            }
        })
    </script>
</body>
</html>